<template>
<div>
  <el-row>
    <el-col :span="1" class="height30">
      单号:
    </el-col>
    <el-col :span="3">
      <el-input v-model="params.docId" size="mini" @blur="getAllDocuments"/>
    </el-col>
    <el-col :span="2" class="height30" align="right">
      起运地:
    </el-col>
    <el-col :span="3">
      <el-input v-model="params.docStart" size="mini" @blur="getAllDocuments"/>
    </el-col>
    <el-col :span="2" class="height30" align="right">
      目的地:
    </el-col>
    <el-col :span="3">
      <el-input v-model="params.docEnd" size="mini" @blur="getAllDocuments"/>
    </el-col>
    <el-col :span="2" class="height30" align="right">
      托运人手机:
    </el-col>
    <el-col :span="3">
      <el-input v-model="params.sinTel" size="mini" @blur="getAllDocuments"/>
    </el-col>
    <el-col :span="2" class="height30" align="right">
      收货人手机:
    </el-col>
    <el-col :span="3">
      <el-input v-model="params.conTel" size="mini" @blur="getAllDocuments"/>
    </el-col>
  </el-row>
  <el-table style="width: 100%;margin-top: 20px" height="500" :data="documents" @row-dblclick="viewDetails">
    <el-table-column label="单号" prop="docId"></el-table-column>
    <el-table-column label="托运人" prop="sinpper"></el-table-column>
    <el-table-column label="托运人电话" prop="sinTel"></el-table-column>
    <el-table-column label="收货人" prop="consignee"></el-table-column>
    <el-table-column label="收货人电话" prop="conTel"></el-table-column>
    <el-table-column label="起运地" prop="docStart"></el-table-column>
    <el-table-column label="目的地" prop="docEnd"></el-table-column>
    <el-table-column label="付款方式" prop="payment"></el-table-column>
    <el-table-column label="交货方式" prop="delivery"></el-table-column>
    <el-table-column label="开单日期" prop="docDate"></el-table-column>
    <el-table-column label="状态" prop="state"></el-table-column>
  </el-table>
</div>
</template>

<script>
import {getAllDoc} from 'network/document.js'

export default {
  data() {
    return {
      params: {
        docId: '',
        docStart: '', //起运地
        docEnd: '', //目的地
        sinTel: '', //托运人电话
        conTel: '', //收货人电话
      },
      documents: []
    }
  },
  methods: {
    getAllDocuments() {
      getAllDoc(this.params).then(res => {
        this.documents = res
      })
    },
    viewDetails(row) {
      this.$store.commit('clickTags',{name: '运单详情',path: "/home/documents/docDetails/"+row.docId})
      this.$store.commit('updActiveNav',this.$store.state.modules.navigation.navigation[0])
      this.$store.commit('updActiveTag',this.$store.state.modules.navigation.navigation[0].content[2])
      this.$router.push("/home/documents/docDetails/"+row.docId)
    }
  }
}
</script>

<style scoped>
.height30{
  line-height: 30px
}
</style>
